<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>修改會員資料</title>
</head>
<body>
<% if(session.getAttribute("access") == "y" ){%>
<jsp:useBean id="mydb" scope="page" class="bean.ConDbBean"/> <%//連結資料庫的bean %>
<%
String num = new String(request.getParameter("Mnum").getBytes("iso-8859-1"),"utf-8");
String id = new String(request.getParameter("id").getBytes("iso-8859-1"),"utf-8"); //防止亂碼
String name = new String(request.getParameter("name").getBytes("iso-8859-1"),"utf-8");
String sex = new String(request.getParameter("sex").getBytes("iso-8859-1"),"utf-8");
String address = new String(request.getParameter("address").getBytes("iso-8859-1"),"utf-8");
String phone = new String(request.getParameter("phone").getBytes("iso-8859-1"),"utf-8");
String email = new String(request.getParameter("email").getBytes("iso-8859-1"),"utf-8");
String dep = new String(request.getParameter("dep").getBytes("iso-8859-1"),"utf-8");
String por_name = new String(request.getParameter("por_name").getBytes("iso-8859-1"),"utf-8");
String level = new String(request.getParameter("level").getBytes("iso-8859-1"),"utf-8");

String sql="UPDATE MEMBER SET M_ID='"+id+"',M_NAME='"+name+"',SEX='"+sex+"'"
+",ADDRESS='"+address+"',PHONE='"+phone+"',EMAIL='"+email+"',DEPARTMENT='"+dep+"'"
+",POR_NAME='"+por_name+"',LEVEL_ID='"+level+"' WHERE M_NUM='"+num+"'";
mydb.executeUpdate(sql);

//out.print(sql);

response.sendRedirect("listmember.jsp"); //直接跳頁到listmember.jsp
%>
<%
  }
  else{
  	response.sendRedirect("../index.jsp"); //若沒有登入則回到index.jsp
  } 
  %>
</body>
</html>